package com.xxxx.microservice.forestry.controller;

import com.xxxx.microservice.forestry.service.ExampleService;
import com.xxxx.microservice.forestry.utils.ApiResponse;
import com.xxxx.microservice.forestry.utils.ResponseCode;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import springfox.documentation.annotations.ApiIgnore;

import java.util.List;
import java.util.Map;

@Api(tags="example")
@ApiIgnore
@RestController
@RequestMapping("/example")
public class ExampleController {

    private static final Logger LOGGER = LoggerFactory.getLogger(ExampleController.class);

    @Autowired
    private ExampleService exampleService;

    @ApiOperation("example")
    @GetMapping ("/example")
    public ApiResponse<List<Map<String, Object>>> example() {
        String packagePath = ExampleController.class.getPackage().toString();
        List<Map<String, Object>> res = exampleService.change();
        return new ApiResponse<>(ResponseCode.SUCCESS, "test success", res);
    }

}
